package games.sence;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.Arrays;

public class MapReader {

    public static void loadMap() {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(MapReader.class.getResourceAsStream("/map/map.txt")));){
            StringBuilder sb = new StringBuilder();
            String line = "";
            while ((line=br.readLine()) != null) {
                sb.append(line.replaceAll(" ", ""));
            }
            String[] arr = sb.toString().split(";");
            for (int i = 0; i < arr.length; i++) {
                String str = arr[i];
                for (int j = 0; j < str.length(); j++) {
                    char ch = str.charAt(j);
                    SceneMap.MAP[i][j] = ch;
                    System.out.println(i + " " + j);
                }
            }
            System.out.println("load map success ......");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
